package com.homework.ch01;

import java.util.function.IntPredicate;

/**
 * @author yuxi
 * @version 1.0
 * @date 2025/10/22
 * @Description:
 */

public class Test2 {
    public static void main(String[] args) {
        printNum(new IntPredicate() {
            @Override
            public boolean test(int num) {
                return num % 2 == 0;
            }
        });
        printNum(num->num%2==0);
    }
    public static void printNum(IntPredicate predicate){
        int[] arr = {1,2,3,4,5,6,7,8,9,10};
        for (int i : arr) {
            if(predicate.test(i)){
                System.out.println(i);
            }
        }
    }
}
